#!/usr/bin/node

//run in Node
//console.log(process.argv);
var fs = require("fs"),path = require("path");
var dir = process.cwd();
if(process.argv.length > 2)
  dir = process.argv[2];
var files = fs.readdirSync(dir);
process.stdout.write("Name\t\tSize\t\tDate\n");
files.forEach(function(name){
  var full_name = path.join(dir,name);
  var stats = fs.statSync(full_name);
  if(stats.isDirectory())
    name += "/";
  process.stdout.write(name + "\t\t" +
    stats.size + "\t\t" +
    stats.mtime + "\n");
});
